package com.hw.springcloud.controller;

import com.hw.springcloud.entity.CommonResult;
import com.hw.springcloud.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @Classname: AccountController
 * @Description: 描述
 * @Date: 2021/12/22
 * @Author: HuWei
 */
@RestController
@RequestMapping("/account")
public class AccountController {

    @Autowired
    private AccountService accountService;

    @GetMapping("/updateAccount/{userId}/{used}")
    public CommonResult<Boolean> updateAccount(@PathVariable("userId")Long userId, @PathVariable("used")BigDecimal used){
        Boolean aBoolean = accountService.updateAccount(userId, used);
        if(aBoolean){
            return new CommonResult<>(200, "账户修改成功", true);
        }
        return new CommonResult<>(500,"账户修改失败", false);
    }
}
